import 'package:get/get.dart';

enum SignStatus {
  ideal(-1, "空闲状态"),
  startUpload(0, "开始上传apk"),
  uploading(1, "正在上传"),
  uploaded(2, "上传完成"),
  uploadFail(3, "上传失败"),
  startSign(4, "开始签名apk"),
  signing(5, "签名中"),
  signFail(6, "签名失败"),
  signSuccess(7, "签名成功"),
  startDownload(8, "开始下载"),
  downloadSuccess(9, "下载成功"),
  cancel(10, "取消");

  final int status;
  final String statusInfo;

  const SignStatus(this.status, this.statusInfo);
}

class SignStatusManager extends GetxController {
  final _currentStatus = Rx<SignStatus>(SignStatus.ideal);
  final _currentStatusInfo = Rx<String>('');

  SignStatus get currentStatus => _currentStatus.value;

  String get currentStatusInfo => _currentStatusInfo.value;

  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();
    // ever(_currentStatus, (callback) => print(callback));
  }

  void updateStatus(SignStatus status) {
    print("updateStatus:$status");
    _currentStatus.value = status;
    _currentStatusInfo.value = status.statusInfo;
  }
}
